using System;
using System.Collections.Generic;
using System.Windows.Forms;

using System.Diagnostics;

namespace MSNSearch
{
	static class Program
	{
		static bool IsModulusElevenChecked ( String textualValue )
		{
			int checkValue = GetModulusEleven(textualValue.Substring(0, textualValue.Length - 1));
			int testValue = 0;
			if(Int32.TryParse(textualValue[textualValue.Length - 1].ToString(), out testValue))
			{
				return checkValue == testValue;
			}
			else
			{
				return false;
			}
		}
		static int GetModulusEleven ( String textualValue )
		{
			int tally = 0;
			for (int i = textualValue.Length; i > 0; --i)
			{
				String temp = new String(textualValue[textualValue.Length - i], 1);
				int digit = 0;
				if(Int32.TryParse(temp, out digit))
				{
					tally += digit * (i + 1);
				}
				else
				{
					throw new InvalidOperationException("dunno");
				}
			}
			int result = (tally % 11);
			return result;
		}
		/// <summary>
		/// The main entry point for the application.
		/// </summary>
		[STAThread]
		static void Main ( )
		{
			bool isSo = IsModulusElevenChecked(3473892.ToString(System.Globalization.CultureInfo.InvariantCulture));
			GetModulusEleven(347389.ToString(System.Globalization.CultureInfo.InvariantCulture));
			try
			{
				Application.EnableVisualStyles();
				Application.SetCompatibleTextRenderingDefault(false);
				Application.Run(new MainForm());
				global::MSNSearch.Properties.Settings.Default.Save();
			}
			catch (Exception exception)
			{
				System.Diagnostics.Trace.WriteLine(exception.ToString());
			}
		}
	}
}